import React, {Component} from 'react'
import {Link} from 'react-router'
import '../sass/Checkout'

export default class Checkout extends Component {
  constructor() {
    super()
  }

  render() {
    const {totalCount, totalPrice, selectAll, ifAllPick, confirmOrder} = this.props

    return (
      <section className="cart-checkout">
        <span
          className="all-pick"
          onClick={selectAll.bind(this, ifAllPick())}
        >
          <i className={ifAllPick() ? 'iconfont icon-shangpinxuankuang-xuanqu1 radio active' : 'iconfont icon-shangpinxuankuang-weixuanqu radio'}></i>
          全选
        </span>
        {
          totalPrice !== '0' ?
          <Link className="link" onClick={confirmOrder.bind(this)}>去结算</Link> :
          <Link className="link disabled">去结算({totalCount})</Link>
        }
        <span className="amount">¥{totalPrice}</span>
      </section>
    )
  }
}
